//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_TSERIALDIRVER_H__
#define __ELASTOS_TSERIALDIRVER_H__

#include "uart.h"

////////////////////////////////////////////////////////////////////////

class TSerialDriver : public CDeviceDriver
{
public:
    CARAPI Read(
        /* [in] */ UInt64 u64Offset,
        /* [in] */ UInt32 bytesToRead,
        /* [out] */ EzByteBuf buffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */ UInt64 u64Offset,
        /* [in] */ EzByteBuf buffer,
        /* [out] */ UInt32 * pBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */ Handle32 nControlCode,
        /* [in] */ EzByteBuf inBuffer,
        /* [out] */ EzByteBuf * pOutBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    virtual void Dispose(){}

public:
    ECode InitHardware();

    UInt16              m_uIoBase;
};

EXTERN IDeviceDriver * CDECL CreateTSerial(uint_t uDeviceNo, void *pvParameter);

#endif  // __ELASTOS_TSERIALDIRVER_H__
